<template>
	<page-meta :root-font-size="`${fontSize}px`"></page-meta>
	<view class="reply-container">
		<view style="padding: 20rpx;">
			<view class="title"><text style="color: red;">*</text>问题或意见反馈内容</view>
			<textarea style="height: 320rpx; font-size: 32rpx;"  :maxlength="500" class="content" v-model="params.content" placeholder="请输入内容..." name="" id="" cols="30" rows="10"></textarea>
		</view>
		<view class="title" style="margin-left: 20rpx;"><text style="color: #fff;">*</text>反馈图片</view>
		<view style="margin-left: 8rpx;">
			<uploader :max="10" @input='onchange'></uploader>
		</view>
		<button style="margin-bottom: 60rpx;" class="patrol-btn" @click="submit">提交</button>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	import uploader from '@/myComponents/image-uploader.vue'
	export default {
		data() {
			return {
				params: {
					projId: uni.getStorageSync('projId'),
					content: '',
					attachments: []
				}
			}
		},
		components: {
			uploader
		},
		computed: {
			...mapState(['fontSize'])
		},
		methods: {
			onchange(e) {
				this.params.attachments = e
			},
			submit() {
				console.log(this.params)
				if(this.params.content.trim() == ''){
					uni.showToast({
						title: '请填写反馈内容',
						icon: 'none'
					})
				}else {
					uni.showLoading({mask: true})
					this.handleSubmit()
				}
			},
			handleSubmit() {
				uni.showLoading({mask: true})
				this.$http2.post('/smart/feedback/create', this.params).then(res => {
					// console.log(res)
					if (res.code === 10000) {
						uni.redirectTo({
							url: '../success/success?path=/ticketSystem/homeFeedBack/homeFeedBack' + '&title=返回意见反馈'
						})
						// uni.redirectTo({
						// 	url: '/ticketSystem/acceptSuccess/acceptSuccess?path=/taskSystem/list/list' + '&title=返回任务首页'
						// })
						
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.reply-container {
		font-size: 32rpx;
		// padding: 20rpx;
		.title {
			margin-bottom: 20rpx;
		}
		.content {
			width: 710rpx;
			padding: 20rpx;
			border: 2rpx solid #ccc;
		}
		.patrol-btn {
			width: 568rpx;
			height: 80rpx;
			line-height: 80rpx;
			margin-left: 91rpx;
			margin-top: 200rpx;
			background: #FF971C;
			// background-color: #1152FC;
			color: #fff;
		}
		.sign-item {
			margin-left: 20rpx;
			width: 220rpx;
			height: 220rpx;
			image {
				width: 100%;
				height: 100%;
			}
		}
	}
</style>